package tutorial.api.extend_api.middle_table;

import org.apache.ibatis.session.SqlSession;
import public_util.model.PublicMiddleTable;
import public_util.model.ReturnData;
import system_api_4_trade.SpecialApplicationAfter;
import system_api_4_trade.dao.ApiPublicMiddleTableMapper;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;

/**
 * 新系统将API扩展成Before和After方法，这里是After方法完成相关的操作
 */
public class SpecialTutorialAfter4MiddleTable extends SpecialApplicationAfter {





    @Override
    public ReturnData public_load_middle_table_list(HttpServletRequest request, ReturnData last_return, SqlSession session, HashMap<String, Object> param2db, List<PublicMiddleTable> tbList) {

        if (tbList == null || tbList.size() == 0)
        {
            return null;
        }
        String table_name = request.getParameter("pre_db_para_middle_table_name");//根据table名来确定是否要做一些调整
        for (int i = 0; i < tbList.size(); i++)
        {
            PublicMiddleTable itemFirst = tbList.get(i);
            String type_middle_app = itemFirst.getType_middle_app() + "";
            String type_inner_app = itemFirst.getType_inner_app() + "";
            if ("public_middle_table_member".equals(table_name))
            {
                if ("1001".equals(type_inner_app) && "10001".equals(type_middle_app))//表名之下,才有type_inner的内容
                {
                    itemFirst.setSave_data_000("0");
                }
            }
        }
        return null;
    }

}
